package com.hzzy.service.impl;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.hzzy.IDao.HzTeacherMapper;
import com.hzzy.bean.HzTeacher;
import com.hzzy.service.HzTeacherService;

@Service
public class HzTeacherServiceImpl implements HzTeacherService {

	@Autowired
	private HzTeacherMapper hzTeacherMapper;
	
	public List<HzTeacher> getHzTeacherByCurrentClassId(int classId) {
		List<HzTeacher> list = hzTeacherMapper.groupByCurrentClassId(classId);
		if (list != null) {
			return list;
		}
		return new ArrayList<HzTeacher>();
	}

	public HzTeacher findByTeacherIdAndPassword(String teacherId, String password) {
		
		Map<String, Object> conditions = new HashMap<String, Object>();
		conditions.put("teacherId", teacherId);
		conditions.put("password", password);
		List<HzTeacher> list = hzTeacherMapper.selectByConditions(conditions);
		if (list != null && list.size() > 0) {
			return list.get(0);
		}
		return null;
	}

}
